The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Changes 04
lib/JavaScript/Packer.pm 93
t/01-io.t 12
t/scripts/s2-expected.js 22
t/scripts/s3-expected.js 11
t/scripts/s4-expected.js 22
t/scripts/s5-expected.js 11
7 files changed (This is a version diff) 1615
@@ -1,5 +1,9 @@
 Revision history for JavaScript-Packer
 
+1.001   2011-01-27
+    - Bugfix: Removed restore pattern.
+    - Added test.
+
 1.000   2011-01-17
     - Changed versioning.
     - Raised major version due to changes in versioning.
@@ -8,13 +8,12 @@ use Regexp::RegGrp;
 
 # =========================================================================== #
 
-our $VERSION = '1.000';
+our $VERSION = '1.001';
 
 our $PACKER_COMMENT     = '\/\*\s*JavaScript::Packer\s*(\w+)\s*\*\/';
 our $COPYRIGHT_COMMENT  = '(\/\*(?>[^\*]|\*[^\/])*copyright(?>[^\*]|\*[^\/])*\*\/)';
 
 our $SHRINK_VARS = {
-    ENCODED_DATA    => qr~\x01(\d+)\x01~,
     BLOCK           => qr/(((catch|do|if|while|with|function)\b[^~{};]*(\(\s*[^{};]*\s*\))\s*)?(\{[^{}]*\}))/,  # function ( arg ) { ... }
     ENCODED_BLOCK   => qr/~#?(\d+)~/,
     CALLER          => qr/((?>[a-zA-Z0-9_\x24\.]+)\s*\([^\(\)]*\))(?=[,\)])/,                                   # do_something( arg1, arg2 ) as argument of another function call
@@ -307,12 +306,7 @@ sub init {
         $self->{$_}->{reggrp} = Regexp::RegGrp->new( { reggrp => $self->{$_}->{reggrp_data} } );
     } ( 'comments', 'clean', 'whitespace', 'concat', 'trim' );
 
-    $self->{data_store}->{reggrp} = Regexp::RegGrp->new(
-        {
-            reggrp          => $self->{data_store}->{reggrp_data},
-            restore_pattern => $SHRINK_VARS->{ENCODED_DATA}
-        }
-    );
+    $self->{data_store}->{reggrp} = Regexp::RegGrp->new( { reggrp => $self->{data_store}->{reggrp_data} } );
 
     $self->{block_data} = [];
 
@@ -734,7 +728,7 @@ JavaScript::Packer - Perl version of Dean Edwards' Packer.js
 
 =head1 VERSION
 
-Version 1.000
+Version 1.001
 
 =head1 DESCRIPTION
 
@@ -8,7 +8,7 @@
 
 use Test::More;
 
-my $not = 15;
+my $not = 16;
 
 SKIP: {
     eval( 'use JavaScript::Packer' );
@@ -25,6 +25,7 @@ SKIP: {
     fileTest( 's7', 'clean', 'compression level "clean" function as argument' );
     fileTest( 's8', 'shrink', 'compression level "shrink" function as argument' );
     fileTest( 's9', 'shrink', 'compression level "shrink" with _no_shrink_ argument' );
+    fileTest( 's10', 'shrink', 'compression level "shrink" with qouted args' );
 
     my $packer = JavaScript::Packer->init();
 
@@ -1,2 +1,2 @@
-function(c){var b='blah blubb';var e=3;alert(b);var g=1;//@a
-var f=c;/*@abcd var g=1;@*/abcd var d=$H()};/*@abcd var x=1;@*/
\ No newline at end of file
+function(b){var a='blah blubb';var d=3;alert(a);var f=1;//@a
+var e=b;/*@abcd var f=1;@*/abcd var c=$H()};/*@abcd var x=1;@*/
\ No newline at end of file
@@ -1 +1 @@
-eval(function(p,a,c,k,e,r){e=String;if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[024-9]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('6(c){0 b=\'8 9\';0 e=3;7(b);0 5=1;//@a\n0 f=c;/*@2 0 5=1;@*/2 0 d=$4()};',[],10,'var||abcd||H|g|function|alert|blah|blubb'.split('|'),0,{}))
\ No newline at end of file
+eval(function(p,a,c,k,e,r){e=String;if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[024-9]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('2(b){0 a=\'7 9\';0 d=3;8(a);0 6=1;//@a\n0 e=b;/*@4 0 6=1;@*/4 0 c=$5()};',[],10,'var||function||abcd|H|f|blah|alert|blubb'.split('|'),0,{}))
\ No newline at end of file
@@ -1,2 +1,2 @@
-function(c){var b='blah blubb';var e=3;alert(b);var g=1;//@a
-var f=c;/*@abcd var g=1;@*/abcd var d=$H()};/*@abcd var x=1;@*/
\ No newline at end of file
+function(b){var a='blah blubb';var d=3;alert(a);var f=1;//@a
+var e=b;/*@abcd var f=1;@*/abcd var c=$H()};/*@abcd var x=1;@*/
\ No newline at end of file
@@ -1 +1 @@
-eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([2-9h-zB-Z]|1[0-9a-zA-Z])'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('5 I=7 3(){5 c=7 X();5 d=3(g){8(!g.2(\'F\'))n;7 B.u(\'/9\'+g.2(\'F\')+\'x.w?\'+6.h(6.l()*m)+\'=\'+6.h(6.l()*m),{v:\'2\',y:3(a){5 f=7 K(\'f\').o(a.t.1k());f.1j(\'1b\').s(3(b){5 e=7 1a();e.N=b.Z(\'N\');c[c.J]=e})}});8(g.2(\'L\')){g.2(\'L\').s(3(e){d(e)})}}n{Q:3(){5 b=C.T();b.s(3(e){d(e)})}}}5 9=7 3(){n{r:3(){5 g=$A(9.r.13);5 a=g.1c();8(!a){n}5 f=7 K(\'1d\');f.12({\'18\':\'M\',\'1o\':\'M\'});8( $(\'i\').17()){7 q.19(\'i\',{10:3(){7 B.u(\'/9\'+a+\'x.w?\'+6.h(6.l()*m)+\'=\'+6.h(6.l()*m),{v:\'2\',y:3(e){5 b=f.o(e.t); $(\'i\').o(b);7 q.G(\'i\',{H:0.E})}})},14:0.E})}O{7 B.u(\'/9\'+a+\'x.w?\'+6.h(6.l()*m)+\'=\'+6.h(6.l()*m),{v:\'2\',y:3(e){ $(\'i\').o(f.o(e.t));7 q.G(\'i\',{H:0.11})}})}}}}5 j=0;S.4.16({D:3(e){n 1i.D(e)},W:3(e){n e.15()}});3 p(b,e){b=b?b:\'/\';8(!j&&b){j=1;9.r(b);C.r(b);z()}}3 1h(b,e){8(!j){4.R(b,e)}p(b,e)}3 z(){5 e=$A(q.1f);8(e.J>0){Y("z();",1n)}O{j=0}}S.1m=3(){4.1e();4.1l(p);C.U();k=4.1g();k=k?k:\'/\';8(4.V()){8(!j){4.R(k,P)}p(k,P)}I.Q()}',[],87,'||get|function|dhtmlHistory|var|Math|new|if|content||||||||round|div_content|wait|initialLocation|random|99999|return|update|handle_location|Effect|process|each|responseText|Request|method|htm|index|onComplete|reset_wait||Ajax|menu|toJSON|01|loc|Appear|from|image|length|Element|subs|0px|src|else|null|preload|add|window|get_menu_hash|init|isFirstLoad|fromJSON|Array|setTimeout|readAttribute|afterFinish|00|setStyle|arguments|to|evalJSON|create|visible|padding|Fade|Image|img|shift|div|initialize|Queue|getCurrentLocation|handle_click|Object|select|stripScripts|addListener|onload|1000|margin'.split('|'),0,{}))
\ No newline at end of file
+eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([2-9h-zB-Z]|1[0-9a-zA-Z])'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('5 I=7 3(){5 c=7 Y();5 d=3(g){8(!g.2(\'F\'))n;7 B.u(\'/9\'+g.2(\'F\')+\'x.w?\'+6.h(6.l()*m)+\'=\'+6.h(6.l()*m),{v:\'2\',y:3(a){5 f=7 K(\'R\').o(a.t.1k());f.1j(\'1c\').s(3(b){5 e=7 1b();e.N=b.10(\'N\');c[c.J]=e})}});8(g.2(\'L\')){g.2(\'L\').s(3(e){d(e)})}}n{Q:3(){5 b=C.U();b.s(3(e){d(e)})}}}5 9=7 3(){n{r:3(){5 g=$A(9.r.14);5 a=g.1d();8(!a){n}5 f=7 K(\'R\');f.13({\'19\':\'M\',\'1o\':\'M\'});8( $(\'i\').18()){7 q.1a(\'i\',{11:3(){7 B.u(\'/9\'+a+\'x.w?\'+6.h(6.l()*m)+\'=\'+6.h(6.l()*m),{v:\'2\',y:3(e){5 b=f.o(e.t); $(\'i\').o(b);7 q.G(\'i\',{H:0.E})}})},15:0.E})}O{7 B.u(\'/9\'+a+\'x.w?\'+6.h(6.l()*m)+\'=\'+6.h(6.l()*m),{v:\'2\',y:3(e){ $(\'i\').o(f.o(e.t));7 q.G(\'i\',{H:0.12})}})}}}}5 j=0;T.4.17({D:3(e){n 1i.D(e)},X:3(e){n e.16()}});3 p(b,e){b=b?b:\'/\';8(!j&&b){j=1;9.r(b);C.r(b);z()}}3 1h(b,e){8(!j){4.S(b,e)}p(b,e)}3 z(){5 e=$A(q.1f);8(e.J>0){Z("z();",1n)}O{j=0}}T.1m=3(){4.1e();4.1l(p);C.V();k=4.1g();k=k?k:\'/\';8(4.W()){8(!j){4.S(k,P)}p(k,P)}I.Q()}',[],87,'||get|function|dhtmlHistory|var|Math|new|if|content||||||||round|div_content|wait|initialLocation|random|99999|return|update|handle_location|Effect|process|each|responseText|Request|method|htm|index|onComplete|reset_wait||Ajax|menu|toJSON|01|loc|Appear|from|image|length|Element|subs|0px|src|else|null|preload|div|add|window|get_menu_hash|init|isFirstLoad|fromJSON|Array|setTimeout|readAttribute|afterFinish|00|setStyle|arguments|to|evalJSON|create|visible|padding|Fade|Image|img|shift|initialize|Queue|getCurrentLocation|handle_click|Object|select|stripScripts|addListener|onload|1000|margin'.split('|'),0,{}))
\ No newline at end of file